<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
        }
        .active{
            border: 1px solid red;
        }
    </style>
</head>
<body>
<div id="app">
    <img v-bind:src="imgSrc" alt="" :title="imgTitle">
    <br>
    <img :src="imgSrc" alt="" :title="imgTitle" :class="isActive?'active':''" @click="toggleActive">
    <br>
    <img :src="imgSrc" alt="" :title="imgTitle" :class="{active:isActive}" @click="toggleActive">
</div>
<script src="js/vue.js"></script>
<script>
    // 创建vue实例
    const app = new Vue({
        el:"#app",
        data:{
            imgSrc:"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=402562594,897838155&fm=11&gp=0.jpg",
            imgTitle:"漂亮的IU",
            isActive:false
        },
        methods:{
            toggleActive:function (){
                this.isActive = !this.isActive;
            }
        }
    })
</script>
</body>
</html>